package com.culture.bootdemo.designPattern设计模式.strategy策略模式;

import com.culture.bootdemo.designPattern设计模式.strategy策略模式.service.MessageService;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wen
 * @date 2019/11/27 14:24
 * @Description
 **/
@Component
public class MessageServiceContext {

    private final Map<Integer, MessageService> handlerMap = new HashMap<>();

    public MessageService getMessageService(Integer type) {
        return handlerMap.get(type);
    }

    public void putMessageService(Integer code, MessageService messageService) {
        handlerMap.put(code, messageService);
    }
}
